home *** CD-ROM | disk | FTP | other *** search
- Path: news.ccs.queensu.ca!news
- From: dmurdoch@mast.queensu.ca (Duncan Murdoch)
- Newsgroups: comp.lang.c++,comp.lang.pascal.delphi.misc
- Subject: Re: C++ with Zapp vs. Delphi
- Date: Tue, 23 Jan 1996 03:21:13 GMT
- Organization: Queen's University, Kingston
- Message-ID: <31044e99.17184110@130.15.126.54>
- References: <4coar6$d4n@sun4.bham.ac.uk> <4coip7$69s@news1.usa.pipeline.com> <DBk8wg2yqjbB083yn@iaccess.za> <4d7pmb$48c8@tigger.cc.uic.edu> <4dk38h$gdr@merlin.delphi.com> <4dksp1$3d6c@tigger.cc.uic.edu> <30fe666e.3349285@130.15.126.54> <4durk2$2r54@tigger.cc.uic.edu> <31038877.2364473@130.15.126.54> <4e15b0$1g68@tigger.cc.uic.edu>
- NNTP-Posting-Host: free1-slip203.tele.queensu.ca
- X-Newsreader: Forte Agent .99c/16.141
-
- olczyk@sunphy1 (Lambert Schoonveld) wrote:
-
- >In your method what if the comparison needs to use private data in the object?
-
- Then it would just access it. The specialized list would normally be
- declared in the same unit as the object type it was sorting (or the
- base class for a hierarchy), so it would have access to private fields
- (like a "friend" in C++).
-
- Yes, this leaves the possibility that you might want to put a
- descendant object into the list, and have the sort order depend on
- some private part of the descendant object, and have the descendant
- object in some other unit so it wasn't a friend.
-
- In a case like that I would have to add a method to the base class to
- produce the key, and override it in the descendant, so I might as well
- just have the Compare method in the object the way you do.
-
- However, I have a hard time imagining a situation where the sort order
- depends on something that's invisible to the sorter, so I'm not going
- to lose sleep over this possibility.
-
- >: Remember, I'm reading this in the Delphi group, and I'm not
- >: particularly familiar with C++ jargon.
- >
- >Strange since it's basis is in Smalltalk.
-
- Well, I'm not familiar with Smalltalk either, and I just didn't guess
- that you would use Smalltalk jargon when talking to people about C++
- and Delphi.
-
- >You have a class called model. It's purpose is to hlod data of some
- >form ( say a record in a database). You have a set of classes
- >called 'views' (say dataaware components). When you create a view
- >it is associated to a model object. When the data stored in the model object
- >changes, it updates the views. When a view changes it updates the model.
-
- You asked how I would implement this in Delphi, which doesn't have MI.
-
-
- The normal way to do it would be to have your views be clients of the
- model class, i.e. each would have a reference to an object of the
- model class as one of its fields. The data would be exposed as
- "properties", which look to the outside like fields, but which are
- implemented using Get and Set methods. When you wanted to look at
- field Name, you'd just look at the Name property of the view, and the
- Get method would get the Name out of the model object. When you set
- the Name in the view, the Set method would set the Name in the model.
-
- It's really all pretty straightforward. MI isn't needed.
-
- I know there are cases where MI is helpful, but sorted lists and views
- of data objects aren't among them.
-
- Since this thread is getting pretty repetitive, and your mailer is
- broken so we can't go to email, I'm going to bow out now. It was nice
- talking to you.
-
- Duncan Murdoch
-